package com.etc.ssm;

import com.etc.ssm.service.GoodsService;
import org.databene.contiperf.PerfTest;
import org.databene.contiperf.junit.ContiPerfRule;
import org.junit.Rule;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * 压力测试，支持junit4所以这里一些注解要有变化
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class GoodsServiceTests_Contiperf {

    @Rule //import org.junit.Rule;
    public ContiPerfRule contiPerfRule = new ContiPerfRule();

    @Autowired
    private GoodsService goodsService;


    //org.databene.contiperf.PerfTest;
    //invocations 请求次数，和线程无关
    //threads 线程数
    @Test //import org.junit.Test;
    @PerfTest(invocations = 3000,threads = 20)
    public void contextLoads() {
        System.out.println(goodsService.showGoods(1, 5, "").getList());
    }



}
